This repository was archived by the owner on Mar 25, 2024. It is now read-only.
Add expand and attributes to get and filter methods #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have ran into the problem numerous times where I need to
.get(id=XXX)
or some filter but I also want some extended attributes on the objects. The way the current structure is laid out, I can get the results. These results are then all loaded with data.As I iterate through my results I need to call
reload(expand=xxx,attributes=yyyy)
.These change adds support for expand and attributes to search results so that the secondary reload is not required.
Side effect of using expand is you get additional Entities on the object. These objects when accessed are type
dict
and not typeEntity
which causes a difference in usage of the api.As an example when I query a service and expand vms, I can call
service.vms
and it will return typeList[dict]
. With the changes here it will look to see if the object has anhref
property. If it does, it will wrap it up as an Entity soservice.vms
will return typeList[Entity]
and allow familiar usage of the api.